//
//  DemandTheHallContentHeadView.m
//  BusinessMarket
//
//  Created by Michael Li on 2018/11/19.
//  Copyright © 2018年 Michael Li. All rights reserved.
//

#import "DemandTheHallContentHeadView.h"
#import "HomeModel.h"
@interface DemandTheHallContentHeadView()
@property(nonatomic,strong) UIImageView *headIV;
@property(nonatomic,strong) UILabel *titleL;
@property(nonatomic,strong) UILabel *industryL;
@property(nonatomic,strong) UILabel *placeL;
@property(nonatomic,strong) UILabel *timeL;
@property(nonatomic,strong) UILabel *lineL;
@property(nonatomic,strong) UILabel *evaluateL;
@end
@implementation DemandTheHallContentHeadView

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = kOrangeBg;
        [self setUpUI];
    }
    return self;
}
-(void)setUpUI
{
    self.headIV = [[UIImageView alloc]initWithFrame:CGRectMake(kWidth-50-18, 14, 50, 50)];
    [self addSubview:self.headIV];
    self.titleL = [[UILabel alloc]initWithFrame:CGRectMake(18, 14, CGRectGetMinX(self.headIV.frame)-18, 50)];
    self.titleL.numberOfLines = 0;
    self.titleL.font = [UIFont systemFontOfSize:16];
    [self addSubview:self.titleL];
    self.industryL = [[UILabel alloc]initWithFrame:CGRectMake(18, CGRectGetMaxY(self.titleL.frame)+10, kWidth-18*2, 20)];
    self.industryL.font = [UIFont systemFontOfSize:16];
    [self addSubview:self.industryL];
    self.placeL = [[UILabel alloc]initWithFrame:CGRectMake(18, CGRectGetMaxY(self.industryL.frame)+10, 100, 20)];
    self.placeL.font = [UIFont systemFontOfSize:16];
    [self addSubview:self.placeL];
    self.timeL = [[UILabel alloc]initWithFrame:CGRectMake(18, CGRectGetMaxY(self.placeL.frame)+10, kWidth-18*2, 20)];
    self.timeL.font = [UIFont systemFontOfSize:16];
    [self addSubview:self.timeL];
    self.lineL = [[UILabel alloc]initWithFrame:CGRectMake(18, CGRectGetMaxY(self.timeL.frame)+10, 100, 1)];
    [self addSubview:self.lineL];
    self.lineL.backgroundColor = kLineColor;
}
- (void)setModel:(HomeModel *)model
{
    _model = model;
    [self.headIV sd_setImageWithURL:[NSURL URLWithString:model.headImg] placeholderImage:[UIImage imageNamed:@"headImg"]];
    self.titleL.text = [NSString stringWithFormat:@"需求概括:%@",model.represent];
    self.industryL.text = [NSString stringWithFormat:@"所属行业:%@",model.industry];
    XLog(@"需求概括:%@",model.represent);
    NSTimeInterval interval    = model.creattime/1000.0;
    NSDate *date               = [NSDate dateWithTimeIntervalSince1970:interval];
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *currentDateStr = [formatter stringFromDate: date];
    self.timeL.text = [NSString stringWithFormat:@"截止时间:%@",currentDateStr];
}
@end
